/* ==============================================================================
 * 创 建 者：LYT
 * 创建日期：2018-03-14	
 * 功能描述：

 * 修 改 人:
 * 修改时间:
 * 修改描述：
 * ==============================================================================*/

//会员信息获取
var getMemberViewUrl = baseUrl + 'MemberF/MemberView';
//退出登录
var LoginoutUrl = baseUrl + 'MemberF/Loginout';

var mescroll;
var vu;


// $(function() {
// 	muiInit();
// 	initVue();
// 	Vue.nextTick(function(){
// 		bindEvent();
// 	})
// })

function initVue(){
	vu=new Vue({
		el:'#content',
		data:{
			searchVal:'', //搜索内容
			WalletList : [],
			member : '',
			Algebra:0,
			
		},
		mounted: function() {
			this.getMemberView();
		},
		methods:{
			getMemberView : getMemberView,
			Loginout : Loginout,
			search:function(){
				if(this.searchVal!=''){
					location.href='searchList.html?goodName='+this.searchVal;
				}else{
					mui.toast('请输入搜索关键词');
				}
			},
		}
	})
}

function Loginout(){
	var btnArray = ['取消', '确定'];
	mui.confirm('确定退出么?', ' ', btnArray, function(e) {
		if(e.index == 1) {
			// common.post(LoginoutUrl,{},'',function(r){
			// 	if(r.ErrorCode==0){
			// 		location.href = "login.html";
			// 	}else{
			// 		mui.toast(r.ErrorMsg);
			// 	}
			// })
			localStorage.clear()
			location.href = "login.html";
		}
	})
}

function getMemberView(){
	common.get(getMemberViewUrl,{},'json',function(r){
		if(r.ErrorCode==0){
			vu.WalletList = r.Data.member.WalletList;
			vu.member = r.Data.member;
			vu.Algebra = r.Data.member.Algebra;
		}else{
			mui.toast(r.ErrorMsg);
		}
	})
}

function muiInit(){
	mui.init();
}

function bindEvent(){
	$("nav").on("tap", "a", function() { //点击触发  
		location.href = $(this).attr("href");
	})
}
